// 私有属性中的get/set
class People {
    private _name: string
    private _age: number

    constructor(name: string, age: number) {
        this._name = name
        this._age = age
    }

    get name(){
        return this._name
    }

    set name(value) {
        this._name = value
    }
}

const xm = new People('小明', 18)
console.log(xm.name)
// console.log(xm.age)